﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.Migrations;
using System.Data.Entity;

namespace SmartSpace.Core
{
    public class InstallService : IInstallService
    {
        private ICoreFactory _factory;
        public InstallService(ICoreFactory factory)
        {
            _factory = factory;
        }

        public bool InstallDatabase()
        {
            using (CoreContext context = _factory.Get())
            {
                if (!context.Database.Exists())
                {
                    context.Database.Create();
                }
                else
                {
                    context.Database.Delete();
                    context.Database.Create();
                }
                return true;
            }
        }
    }
}
